package com.seari.service.Impl;

import com.seari.bean.CreateTableInfo;
import com.seari.bean.DropTableInfo;
import com.seari.bean.MetroFluxnew;
import com.seari.mapper.TblMetroFluxNewMapper;
import com.seari.service.ReadFileDataInsertToOraService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Transactional
@Service("readFileDataInsertToOraService")
public class ReadFileDataInsertToOraServiceImpl implements ReadFileDataInsertToOraService {

    @Autowired
    public TblMetroFluxNewMapper tblMetroFluxNewMapper;

    @Override
    public int judgeTableIsorNotExist(CreateTableInfo ct) throws Exception{

        return tblMetroFluxNewMapper.judgeTableIsorNotExist(ct);
    }

    public void createTable(CreateTableInfo ct) throws Exception{

        tblMetroFluxNewMapper.createTable(ct);
    }

    public void insertPDDataToDatabases(String tableName, List<MetroFluxnew> metroFluxnews) throws  Exception{

        tblMetroFluxNewMapper.insertPDDataToDatabases(tableName,metroFluxnews);

    }

    public List<DropTableInfo> selectTableInfo() throws  Exception{

         return tblMetroFluxNewMapper.selectTableInfo();
    }

    public void dropTable(List<DropTableInfo> dropList) throws Exception{

        for(DropTableInfo drop : dropList){
            tblMetroFluxNewMapper.dropTable(drop);
        }
    }
}
